package com.bestcem.xm.ticket.enums;

import lombok.Getter;

/**
 * 品牌露出枚举
 *
 * @author ympan <yuming.pan@idiaoyan.com>
 * @version v1.0
 * @date 2021/8/27 13:39
 */
@Getter
public enum OrganizationFooterEnum {
    /**
     * 全部露出
     */
    ORGANIZATION_FOOTER_ALL("ORGANIZATION_FOOTER_ALL", 0),

    /**
     * 尾部露出
     */
    ORGANIZATION_FOOTER_END("ORGANIZATION_FOOTER_END", 1),

    /**
     * 不露出
     */
    ORGANIZATION_FOOTER_NO("ORGANIZATION_FOOTER_NO", 2),

    /**
     * 其他(备用)
     */
    ORGANIZATION_FOOTER_OTHER("ORGANIZATION_FOOTER_OTHER", 3);

    private final String name;

    private final Integer index;

    OrganizationFooterEnum(String name, Integer index) {
        this.name = name;
        this.index = index;
    }

    /**
     * 根据 index 获取枚举实体
     * 找不到则返回 null
     *
     * @param index 品牌露出index
     * @return 品牌露出枚举
     * @author <yuming.pan@idiaoyan.com>
     * @date 13:40 2021/8/27
     */
    public static OrganizationFooterEnum getByIndex(Integer index) {
        for (OrganizationFooterEnum value : values()) {
            if (value.getIndex().equals(index)) {
                return value;
            }
        }
        return null;
    }
}
